﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AiXiu.Model;
using AiXiu.BLL;
using AiXiu.Common;

namespace AiXiu.WebSite
{
    public partial class Loin1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.txtName.Attributes["value"] = txtName.Text;
            this.txtPhone.Attributes["value"] = txtPhone.Text;
            this.txtPwd.Attributes["value"] = txtPwd.Text;

        }

        protected void btnDL_Click(object sender, EventArgs e)
        {
  
            if (Page.IsValid) {
                string koko = txtYZM.Text;
                if (koko!= Session["yanzheng"].ToString()) {
                    this.Alert("codeerror","验证码有误");
                    return;
                }
            
                LoginBLL LoginBLL = new LoginBLL();
                TBLogins login = new TBLogins();
                login.UserName = txtName.Text;
                login.MobileNumber = txtPhone.Text;
                login.Password = txtPwd.Text;

                OperResult result = LoginBLL.Result(login);
                if (result.StatusCode == StatusCode.Succeed)
                {
                    this.AlertAndRedirect("regsuccess", "注册成功", "Login.aspx");
                }
                else
                {
                    this.Alert("regerror","注册失败:"+result.Message);
                }

            }
        }
    }
}